export default {
  getAllCount (state) {
    var c = 0
    state.cart.forEach(item => {
      c += item.count
    })
    return c
  },
  getGoodsCount (state) {
    var o = {}
    state.cart.forEach(item => {
      o[item.id] = item.count
    })
    return o
  },
  getGoodSelected (state) {
    var o = {}
    state.cart.forEach(item => {
      o[item.id] = item.selected
    })
    return o
  },
  getSelectedCountAndAmount (state) {
    var o = {
      selectedCount: 0,
      amount: 0
    }
    state.cart.forEach(item => {
      if (item.selected) {
        o.selectedCount += item.count
        o.amount += item.sell_price * item.count
      }
    })
    return o
  }
}
